package com.itheima.dao;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

@Mapper
public interface OrdersettingDao {
    @Insert("insert into t_ordersetting(orderDate, number) VALUES (#{orderDate},#{number})")
    void insert(OrderSetting orderSetting);

    @Update("update t_ordersetting set number=#{number} where orderDate=#{orderDate};")
    void update(Integer number, Date orderDate);

    //传入该月第一天和最后一天，去数据库查找该月数据
    @Select("select orderDate,number,reservations from t_ordersetting " +
            "where orderDate >= #{beginDate} and orderDate <= #{endDate} order by orderDate ;")
    List<OrderSetting> getOrderSettingByMonth(Date beginDate, Date endDate);


}
